﻿/**********************************************************************
* @file   FITKAcousticsSensorsMgrAdaptor.h
* @brief  FE传感器树读写适配器
* @author yangjing (1195810980@qq.com)
* @date   2025-02-25
*********************************************************************/

#ifndef _FITFK_ACOUSTICS_SENSORS_MANAGER_ADAPTOR_H___
#define _FITFK_ACOUSTICS_SENSORS_MANAGER_ADAPTOR_H___

#include "FITKAcousticsAbstractAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include <H5Cpp.h>
namespace IO {
    class FITKHDF5FileTool;
}

namespace Acoustics {
    class FITKAcousticsSensorsManager;
    class FITKAcousticsSensors;
}

namespace IO
{
    class FITKAcousticsHDF5IOAPI FITKAcousticsSensorsMgrAdaptor : public FITKAcousticsAbsAdaptor
    {
    public:
        explicit FITKAcousticsSensorsMgrAdaptor() = default;
        virtual ~FITKAcousticsSensorsMgrAdaptor() = default;

        virtual bool adaptR() override;

        virtual bool adaptW() override;
    private:
        /**
        * @brief 写FE传感器数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  FESensorsManager   FE传感器管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2025-2-18
        */
        bool writeFESensorsMgr(H5::Group &gp, Acoustics::FITKAcousticsSensorsManager* FESensorsManager);


        /**
        * @brief 读FE传感器数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  FESensorsManager   FE传感器管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2025-2-18
        */
        bool readFESensorsMgr(H5::Group &gp, Acoustics::FITKAcousticsSensorsManager* FESensorsManager);

        /**
        * @brief 写FE传感器子类数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  sen   子类数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-2-18
        */
        bool writeSub(H5::Group&gp, Acoustics::FITKAcousticsSensors* sen);

        /**
        * @brief 写FE传感器父类数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  sen   抽象父类数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-2-18
        */
        bool writeParent(H5::Group&gp, Acoustics::FITKAcousticsSensors* sen);


        /**
        * @brief 读FE传感器父类数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  sen   待填充数据的类
        * @author yangjing (1195810980@qq.com)
        * @date 2025-2-18
        */
        bool readParent(H5::Group&gp, Acoustics::FITKAcousticsSensors* sen);


        /**
        * @brief 读FE传感器子类数据
        * @param @param[i]  gp hdf5组别
        * @param @param[i]  sen   待填充数据的类
        * @author yangjing (1195810980@qq.com)
        * @date 2025-2-18
        */
        bool readSub(H5::Group&gp, Acoustics::FITKAcousticsSensors* sen);

    private:
        IO::FITKHDF5FileTool*m_toolp{ nullptr };
    };
    Register2FITKIOAdaptorFactory(FITKAcousticsHDF5, Acoustics::FITKAcousticsSensorsManager, FITKAcousticsSensorsMgrAdaptor);
}
#endif
